﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace ZombieMapEditor
{
    public class Wall
    {
        public WallPoint P1;
        public WallPoint P2;
        public List<int> Allowed;
        public void Draw(Graphics g)
        {
            g.DrawLine(Pens.Blue, P1.Position, P2.Position);
            P1.Draw(g);
            P2.Draw(g);
        }
    }

    public class WallPoint : MapObject
    {
        public Wall Container;

        public void Draw(Graphics g)
        {
            g.FillEllipse(Selected ? Brushes.Purple : Brushes.Blue, Position.X - 5f, Position.Y - 5f, 10f, 10f);
        }

        public WallPoint(PointF position, Wall container)
        {
            Selected = false;
            Position = position;
            Container = container;
        }

        public bool PointCollision(PointF p)
        {
            PointF p2 = PointF.Subtract(p, new SizeF(Position));
            return Math.Sqrt(p2.X * p2.X + p2.Y * p2.Y) < 6;
        }
    }
}
